#include "widget.h"
#include "ui_widget.h"

#include<QPushButton>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    myButton = new QPushButton(this);
    myButton->setText("heloo zy");

    //信号槽的连接
    connect(myButton,&QPushButton::clicked,this,&Widget::handleClick);

}

Widget::~Widget()
{
    delete ui;
}

void Widget::handleClick()
{
    if(myButton->text()==QString("heloo zy"))
    {
        myButton->setText("hello qt");
    }
    else {
        myButton->setText("zy");
    }
}

